<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>常用指令: v-show</title>
</head>
<script src="js/vue.js"></script>
<script>
    window.onload = function () {
        new Vue({
            el: '#app',
            data: {
                flag: true
            },
            methods: {
                change() {
                    this.flag = !this.flag;
                }
            }
        })
    }
</script>

<body>
    <div id="app">
        <button v-on:click="change">隐藏/显示</button>
        <!--<div style="width: 100px; height:100px; background-color: red; " v-show="flag">欢迎使用Vue</div>-->
        <div style="width: 100px; height:100px; background-color: red; " v-if="flag">欢迎使用Vue</div>
    </div>
</body>

</html>